#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
struct student
{
	char name[20];
	int v;
};
struct student stu[100];
bool cmp(student a,student b)
{
	if(a.v==b.v)
		return strcmp(a.name,b.name)>0;
	return a.v < b.v;
}

int main()
{
	int n,i,k;
	scanf("%d%d",&n,&k);
	for(i=0 ; i<n ; i++ )
		scanf("%s%d",&stu[i].name,&stu[i].v);
	sort(stu,stu+n,cmp);
	printf("%s\n",stu[k-1].name);
	return 0;
}
